home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / anacroz.swf / scripts / DefineSprite_1731 / frame_1 / DoAction_2.as next >
Text File  |  2010-11-09  |  6KB  |  178 lines

  1. if(onPress == undefined)
  2. {
  3.    onPress = function()
  4.    {
  5.       _root.it_selx = _X;
  6.       _root.it_sely = _Y;
  7.       if(_name == "item")
  8.       {
  9.          if(_currentframe > 1)
  10.          {
  11.             this.useHandCursor = true;
  12.             _root.it_depth = _parent.getDepth();
  13.             _parent.swapDepths(_root.getNextHighestDepth());
  14.             startDrag(this,0,-1 * _parent._x,-50,560 - _parent._x,60);
  15.          }
  16.       }
  17.       else if(_name.length <= 4)
  18.       {
  19.          _root.it_depth = this.getDepth();
  20.          this.swapDepths(_root.getNextHighestDepth());
  21.          startDrag(this,0,20,170,690,450);
  22.       }
  23.    };
  24.    onReleaseOutside = function()
  25.    {
  26.       stopDrag();
  27.       if(_name == "item")
  28.       {
  29.          _parent.swapDepths(_root.it_depth);
  30.          this.useHandCursor = false;
  31.       }
  32.       else
  33.       {
  34.          this.swapDepths(_root.it_depth);
  35.       }
  36.       _X = _root.it_selx;
  37.       _Y = _root.it_sely;
  38.    };
  39.    onRelease = function()
  40.    {
  41.       _root.fx.attachSound("pagamento");
  42.       if(_name == "item")
  43.       {
  44.          _parent.swapDepths(_root.it_depth);
  45.          if(this.hitTest(_root.venda))
  46.          {
  47.             var _loc4_ = _parent._name.substr(4);
  48.             _root.edFundos = Number(_root.edFundos) + Math.round(_root.it_valores[this._currentframe - 2][4] * 0.8);
  49.             _root.client.removeItem(_loc4_ - 1);
  50.             _root.fx.start();
  51.             _root.venda.play();
  52.          }
  53.       }
  54.       else
  55.       {
  56.          this.swapDepths(_root.it_depth);
  57.          if(this.hitTest(_root.item1))
  58.          {
  59.             if(_root.checkItem(_root.client,this._currentframe - 2))
  60.             {
  61.                if(_root.item1.item._currentframe == 1)
  62.                {
  63.                   if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
  64.                   {
  65.                      _root.client.addItem(_name.substr(2) - 1);
  66.                      _root.edFundos -= _root.it_valores[this._currentframe - 2][4];
  67.                      _root.fx.start();
  68.                   }
  69.                   else
  70.                   {
  71.                      _root.showAlert("N├úo h├í fundos suficientes para comprar este item!");
  72.                   }
  73.                }
  74.             }
  75.             else
  76.             {
  77.                _root.showAlert("Este soldado n├úo pode usar este tipo de item!");
  78.             }
  79.          }
  80.          else if(this.hitTest(_root.item2))
  81.          {
  82.             if(_root.checkItem(_root.client,this._currentframe - 2))
  83.             {
  84.                if(_root.item2.item._currentframe == 1)
  85.                {
  86.                   if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
  87.                   {
  88.                      _root.client.addItem(_name.substr(2) - 1);
  89.                      _root.edFundos -= _root.it_valores[this._currentframe - 2][4];
  90.                      _root.fx.start();
  91.                   }
  92.                   else
  93.                   {
  94.                      _root.showAlert("N├úo h├í fundos suficientes para comprar este item!");
  95.                   }
  96.                }
  97.             }
  98.             else
  99.             {
  100.                _root.showAlert("Este soldado n├úo pode usar este tipo de item!");
  101.             }
  102.          }
  103.          else if(this.hitTest(_root.item3))
  104.          {
  105.             if(_root.checkItem(_root.client,this._currentframe - 2))
  106.             {
  107.                if(_root.item3.item._currentframe == 1)
  108.                {
  109.                   if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
  110.                   {
  111.                      _root.client.addItem(_name.substr(2) - 1);
  112.                      _root.edFundos -= _root.it_valores[this._currentframe - 2][4];
  113.                      _root.fx.start();
  114.                   }
  115.                   else
  116.                   {
  117.                      _root.showAlert("N├úo h├í fundos suficientes para comprar este item!");
  118.                   }
  119.                }
  120.             }
  121.             else
  122.             {
  123.                _root.showAlert("Este soldado n├úo pode usar este tipo de item!");
  124.             }
  125.          }
  126.          else if(this.hitTest(_root.item4))
  127.          {
  128.             if(_root.checkItem(_root.client,this._currentframe - 2))
  129.             {
  130.                if(_root.item4.item._currentframe == 1)
  131.                {
  132.                   if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
  133.                   {
  134.                      _root.client.addItem(_name.substr(2) - 1);
  135.                      _root.edFundos -= _root.it_valores[this._currentframe - 2][4];
  136.                      _root.fx.start();
  137.                   }
  138.                   else
  139.                   {
  140.                      _root.showAlert("N├úo h├í fundos suficientes para comprar este item!");
  141.                   }
  142.                }
  143.             }
  144.             else
  145.             {
  146.                _root.showAlert("Este soldado n├úo pode usar este tipo de item!");
  147.             }
  148.          }
  149.          else if(this.hitTest(_root.item5))
  150.          {
  151.             if(_root.checkItem(_root.client,this._currentframe - 2))
  152.             {
  153.                if(_root.item5.item._currentframe == 1)
  154.                {
  155.                   if(_root.it_valores[this._currentframe - 2][4] <= _root.edFundos)
  156.                   {
  157.                      _root.client.addItem(_name.substr(2) - 1);
  158.                      _root.edFundos -= _root.it_valores[this._currentframe - 2][4];
  159.                      _root.fx.start();
  160.                   }
  161.                   else
  162.                   {
  163.                      _root.showAlert("N├úo h├í fundos suficientes para comprar este item!");
  164.                   }
  165.                }
  166.             }
  167.             else
  168.             {
  169.                _root.showAlert("Este soldado n├úo pode usar este tipo de item!");
  170.             }
  171.          }
  172.       }
  173.       stopDrag();
  174.       _X = _root.it_selx;
  175.       _Y = _root.it_sely;
  176.    };
  177. }
  178.